package com.xmlstrategys
{
	import com.strategy.IXML;
	import com.utils.Utils;
	
	import flash.utils.ByteArray;
	
	public class XMLCItem extends XMLBase implements IXML
	{
		public function XMLCItem(data:XML)
		{
			super(data);
		}
		
		public function xmlstrategybml():ByteArray
		{
			var sourceByte:ByteArray = Utils.writeHead(8);
			var itemLen:uint = xmlData.items.length();
			sourceByte.writeUnsignedInt(itemLen);
			
			for each (var xml:XML in xmlData.items){
				sourceByte.writeUnsignedInt(xml.@templateID);
				sourceByte.writeUnsignedInt(xml.@mainClass);
				sourceByte.writeUnsignedInt(xml.@subClass);
				Utils.writeString(xml.@name,sourceByte);
				Utils.writeString(xml.@description,sourceByte);
				sourceByte.writeUnsignedInt(xml.@attack);
				sourceByte.writeUnsignedInt(xml.@defence);
				sourceByte.writeUnsignedInt(xml.@normalHit);
				sourceByte.writeUnsignedInt(xml.@normalDodge);
				sourceByte.writeUnsignedInt(xml.@criticalDamage);
				sourceByte.writeUnsignedInt(xml.@criticalRate);
				sourceByte.writeUnsignedInt(xml.@skillHit);
				sourceByte.writeUnsignedInt(xml.@skillDodge);
				sourceByte.writeUnsignedInt(xml.@hpBonus);
				sourceByte.writeUnsignedInt(xml.@mpBonus);
				sourceByte.writeUnsignedInt(xml.@resistance1);
				sourceByte.writeUnsignedInt(xml.@resistance2);
				sourceByte.writeUnsignedInt(xml.@resistance3);
				sourceByte.writeUnsignedInt(xml.@resistance4);
				sourceByte.writeUnsignedInt(xml.@resistance5);
				sourceByte.writeUnsignedInt(xml.@crtrateReduce);
				sourceByte.writeUnsignedInt(xml.@crtdmgReduce);
				sourceByte.writeUnsignedInt(xml.@damageReduce);
				sourceByte.writeUnsignedInt(xml.@minAttack);
				sourceByte.writeUnsignedInt(xml.@maxAttack);
				
				sourceByte.writeUnsignedInt(xml.@AdditionFields0);
				sourceByte.writeUnsignedInt(xml.@AdditionFields1);
				sourceByte.writeUnsignedInt(xml.@AdditionFields2);
				
				sourceByte.writeUnsignedInt(xml.@job);
				sourceByte.writeUnsignedInt(xml.@requiredLevel);
				sourceByte.writeUnsignedInt(xml.@sex);
				sourceByte.writeUnsignedInt(xml.@binding);
				sourceByte.writeUnsignedInt(xml.@flags);
				sourceByte.writeUnsignedInt(xml.@timeLimit);
				sourceByte.writeUnsignedInt(xml.@color);
				sourceByte.writeUnsignedInt(xml.@Set);
				sourceByte.writeUnsignedInt(xml.@setUnit);
				sourceByte.writeUnsignedInt(xml.@maxCount);
				sourceByte.writeUnsignedInt(xml.@priceOut);
				sourceByte.writeUnsignedInt(xml.@img);
				sourceByte.writeUnsignedInt(xml.@dropIconId);
			}
			
			return sourceByte;
		}
	}
}